from poloniex.poloniexAPI import *



def GetCoinNum(coinjson, ak, sk):
    pol = poloniex(ak, sk)
    coins = pol.returnBalances()
    #print(coins)
    #myCoins = coins['balances']
    for i in coins.keys():
        num = (float)(coins[i]['available'])
        num2 = (float)(coins[i]['onOrders'])
        if num > 0:
            if i.lower() in coinjson.keys():
                coinjson[i.lower()] = coinjson[i.lower()] + num + num2
            else:
                coinjson[i.lower()] = num + num2


#GetCoinNum('',ACCESS_KEY,SECRET_KEY)